package router

import (
	"gitee.com/baizhige/go-server-tempalte/common/constant"
	"gitee.com/baizhige/go-server-tempalte/common/log"
	"github.com/gin-gonic/gin"
)

func signValid(traceId string, c *gin.Context, router *Router) error {
	f, ok := signMethod[router.SignMethod]
	if !ok {
		log.ErrorTF(traceId, "router:%s ,invalid sign method:%s", router.Id, router.SignMethod)
		return constant.ErrSignMethod
	}
	return f(traceId, c)
}

// 签名方法map
var signMethod = map[string]func(traceId string, c *gin.Context) error{
	"": none,
}

// 空则不需要签名
func none(traceId string, c *gin.Context) error {
	return nil
}
